﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Core.Rules
{
    //not used
    class KeyWords_Rule : IRule
    {
        public double apply(SiteEnum site, QuestionInformation info)
        {
            int postsWithKeywords = 0;
            Regex keyWordRegex = new Regex("\b(enjoy|helped|great)\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); 
            foreach (var reply in info.Replies)
            {
                if (keyWordRegex.IsMatch(reply.ReplyText)) postsWithKeywords++;
            }
            return postsWithKeywords;
        }

        public string RuleName
        {
            get { return "KeyWords_Rule"; }
        }
    }
}
